import {USER_LOGIN, USER_LOGOUT, LOGIN_START, LOGIN_SUCCESS, LOGIN_FAIL} from '../constant/ReduxConstant'

let initial = {
    isAuth: false,
    user: [],
    loginStart: false
}

function loginReducer(state = initial, action) {
    switch (action.type) {
        case USER_LOGIN:
            return {...state, isAuth: true};
        case LOGIN_SUCCESS:
            return {...state, isAuth: true};
        case LOGIN_FAIL:
            return {...state, loginStart: false};
        case LOGIN_START:
            return {...state, loginStart: true}
        case USER_LOGOUT:
            return {...state, isAuth: false}
        default:
            return state
    }
}


export default loginReducer;
